<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QtWebApp: stefanfrings::StaticFileController Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">QtWebApp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classstefanfrings_1_1StaticFileController.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classstefanfrings_1_1StaticFileController-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">stefanfrings::StaticFileController Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Delivers static files.  
 <a href="classstefanfrings_1_1StaticFileController.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="staticfilecontroller_8h_source.html">staticfilecontroller.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for stefanfrings::StaticFileController:</div>
<div class="dyncontent">
<div class="center"><img src="classstefanfrings_1_1StaticFileController__inherit__graph.png" border="0" usemap="#astefanfrings_1_1StaticFileController_inherit__map" alt="Inheritance graph"/></div>
<map name="astefanfrings_1_1StaticFileController_inherit__map" id="astefanfrings_1_1StaticFileController_inherit__map">
<area shape="rect" title="Delivers static files." alt="" coords="16,169,184,211"/>
<area shape="rect" href="classstefanfrings_1_1HttpRequestHandler.html" title="The request handler generates a response for each HTTP request." alt="" coords="5,80,195,121"/>
<area shape="rect" title=" " alt="" coords="63,5,137,32"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for stefanfrings::StaticFileController:</div>
<div class="dyncontent">
<div class="center"><img src="classstefanfrings_1_1StaticFileController__coll__graph.png" border="0" usemap="#astefanfrings_1_1StaticFileController_coll__map" alt="Collaboration graph"/></div>
<map name="astefanfrings_1_1StaticFileController_coll__map" id="astefanfrings_1_1StaticFileController_coll__map">
<area shape="rect" title="Delivers static files." alt="" coords="16,169,184,211"/>
<area shape="rect" href="classstefanfrings_1_1HttpRequestHandler.html" title="The request handler generates a response for each HTTP request." alt="" coords="5,80,195,121"/>
<area shape="rect" title=" " alt="" coords="63,5,137,32"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a8ddcf4fc3db1fdc25ddafec29f0d05b2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1StaticFileController.html#a8ddcf4fc3db1fdc25ddafec29f0d05b2">StaticFileController</a> (const QSettings *settings, QObject *parent=nullptr)</td></tr>
<tr class="memdesc:a8ddcf4fc3db1fdc25ddafec29f0d05b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="classstefanfrings_1_1StaticFileController.html#a8ddcf4fc3db1fdc25ddafec29f0d05b2">More...</a><br /></td></tr>
<tr class="separator:a8ddcf4fc3db1fdc25ddafec29f0d05b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88bbd874c62c8335d0775629b22871a1"><td class="memItemLeft" align="right" valign="top"><a id="a88bbd874c62c8335d0775629b22871a1"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1StaticFileController.html#a88bbd874c62c8335d0775629b22871a1">service</a> (<a class="el" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a> &amp;request, <a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a> &amp;response)</td></tr>
<tr class="memdesc:a88bbd874c62c8335d0775629b22871a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates the response. <br /></td></tr>
<tr class="separator:a88bbd874c62c8335d0775629b22871a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classstefanfrings_1_1HttpRequestHandler"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classstefanfrings_1_1HttpRequestHandler')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classstefanfrings_1_1HttpRequestHandler.html">stefanfrings::HttpRequestHandler</a></td></tr>
<tr class="memitem:a436ce22e3f9d0187e1718e010f0b8a32 inherit pub_methods_classstefanfrings_1_1HttpRequestHandler"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpRequestHandler.html#a436ce22e3f9d0187e1718e010f0b8a32">HttpRequestHandler</a> (QObject *parent=nullptr)</td></tr>
<tr class="memdesc:a436ce22e3f9d0187e1718e010f0b8a32 inherit pub_methods_classstefanfrings_1_1HttpRequestHandler"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="classstefanfrings_1_1HttpRequestHandler.html#a436ce22e3f9d0187e1718e010f0b8a32">More...</a><br /></td></tr>
<tr class="separator:a436ce22e3f9d0187e1718e010f0b8a32 inherit pub_methods_classstefanfrings_1_1HttpRequestHandler"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a32bf6b0e36dbdb4cd0525d2c4b54fdec inherit pub_methods_classstefanfrings_1_1HttpRequestHandler"><td class="memItemLeft" align="right" valign="top"><a id="a32bf6b0e36dbdb4cd0525d2c4b54fdec"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpRequestHandler.html#a32bf6b0e36dbdb4cd0525d2c4b54fdec">~HttpRequestHandler</a> ()</td></tr>
<tr class="memdesc:a32bf6b0e36dbdb4cd0525d2c4b54fdec inherit pub_methods_classstefanfrings_1_1HttpRequestHandler"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:a32bf6b0e36dbdb4cd0525d2c4b54fdec inherit pub_methods_classstefanfrings_1_1HttpRequestHandler"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Delivers static files. </p>
<p>It is usually called by the applications main request handler when the caller requests a path that is mapped to static files. </p>
<p>The following settings are required in the config file: <code></p><pre>
path=../docroot
encoding=UTF-8
maxAge=60000
cacheTime=60000
cacheSize=1000000
maxCachedFileSize=65536
</pre><p></code> The path is relative to the directory of the config file. In case of windows, if the settings are in the registry, the path is relative to the current working directory. </p>
<p>The encoding is sent to the web browser in case of text and html files. </p>
<p>The cache improves performance of small files when loaded from a network drive. Large files are not cached. Files are cached as long as possible, when cacheTime=0. The maxAge value (in msec!) controls the remote browsers cache. </p>
<p>Do not instantiate this class in each request, because this would make the file cache useless. Better create one instance during start-up and call it when the application received a related HTTP request. </p>

<p class="definition">Definition at line <a class="el" href="staticfilecontroller_8h_source.html#l00045">45</a> of file <a class="el" href="staticfilecontroller_8h_source.html">staticfilecontroller.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a8ddcf4fc3db1fdc25ddafec29f0d05b2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ddcf4fc3db1fdc25ddafec29f0d05b2">&#9670;&nbsp;</a></span>StaticFileController()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StaticFileController::StaticFileController </td>
          <td>(</td>
          <td class="paramtype">const QSettings *&#160;</td>
          <td class="paramname"><em>settings</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QObject *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>nullptr</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">settings</td><td>Configuration settings, usually stored in an INI file. Must not be 0. Settings are read from the current group, so the caller must have called settings-&gt;beginGroup(). Because the group must not change during runtime, it is recommended to provide a separate QSettings instance that is not used by other parts of the program. The <a class="el" href="classstefanfrings_1_1StaticFileController.html" title="Delivers static files.">StaticFileController</a> does not take over ownership of the QSettings instance, so the caller should destroy it during shutdown. </td></tr>
    <tr><td class="paramname">parent</td><td>Parent object </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="staticfilecontroller_8cpp_source.html#l00013">13</a> of file <a class="el" href="staticfilecontroller_8cpp_source.html">staticfilecontroller.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>httpserver/<a class="el" href="staticfilecontroller_8h_source.html">staticfilecontroller.h</a></li>
<li>httpserver/<a class="el" href="staticfilecontroller_8cpp_source.html">staticfilecontroller.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>stefanfrings</b></li><li class="navelem"><a class="el" href="classstefanfrings_1_1StaticFileController.html">StaticFileController</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
